<?php /* Smarty version Smarty-3.1.12, created on 2016-05-17 16:36:20
         compiled from "/home/weixincn86dwleoi1xmibn6cinm896/wwwroot/dm/xycms/listsp.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1630624840573ad804653144-57348063%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '0a9c16b59f2c5bb855abb27d09038edb72c0bf42' => 
    array (
      0 => '/home/weixincn86dwleoi1xmibn6cinm896/wwwroot/dm/xycms/listsp.tpl',
      1 => 1448863344,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1630624840573ad804653144-57348063',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'page_charset' => 0,
    'copyright_author' => 0,
    'action' => 0,
    'splist' => 0,
    'volist' => 0,
    'uc_adminname' => 0,
    'total' => 0,
    'cate_select_p' => 0,
    'id' => 0,
    'sp_edit' => 0,
    'cate_select' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.12',
  'unifunc' => 'content_573ad804800fa1_89632565',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_573ad804800fa1_89632565')) {function content_573ad804800fa1_89632565($_smarty_tpl) {?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $_smarty_tpl->tpl_vars['page_charset']->value;?>
" />
<title>概况分类</title>
<meta name="author" content="<?php echo $_smarty_tpl->tpl_vars['copyright_author']->value;?>
" />
<link type="text/css" rel="stylesheet" href="xycms/css/admin.css" media="screen" />
<script type='text/javascript' src='js/jquery-1.8.3.min.js'></script>
<script type='text/javascript' src='js/command.js'></script>
<script type="text/javascript" src='../data/editor/kindeditor.js'></script>
</head>
<body>
<?php if ($_smarty_tpl->tpl_vars['action']->value==''){?>
<div class="main-wrap">
  <div class="path"><p>当前位置：内容中心<span>&gt;</span>碎片管理</p></div>
  <div class="main-cont">
    <h3 class="title"><a href="listsp.php?action=add" class="btn-general">添加碎片</a>碎片管理</h3>
	<form action="listsp.php" method="post" name="myform" id="myform" style="margin:0">
	<input type="hidden" name="action" id="action" value="del" />
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table" align="center">
	  <thead class="tb-tit-bg">
	  <tr>
	    <th width="5%"><div class="th-gap">选择</div></th>
		<th width="12%"><div class="th-gap">碎片名称</div></th>
		<th width="12%"><div class="th-gap">调用标签</div></th>
		<th width="11%"><div class="th-gap">类型</div></th>
		<th width="12%"><div class="th-gap">调用分类</div></th>
		<th width="8%"><div class="th-gap">推荐</div></th>
		<th width="8%"><div class="th-gap">新品</div></th>
		<th width="8%"><div class="th-gap">排序</div></th>
		<th width="8%"><div class="th-gap">数目</div></th>
		<th><div class="th-gap">操作</div></th>
	  </tr>
	  </thead>
	  <tfoot class="tb-foot-bg"></tfoot>
	  <?php  $_smarty_tpl->tpl_vars['volist'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['volist']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['splist']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['volist']->key => $_smarty_tpl->tpl_vars['volist']->value){
$_smarty_tpl->tpl_vars['volist']->_loop = true;
?>
	  <tr>
	    <td align="center"><input name="id[]" type="checkbox" value="<?php echo $_smarty_tpl->tpl_vars['volist']->value['id'];?>
" /></td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['spname'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['splabel'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['np'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['sp_cate'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['recommend'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['isnew'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['orders'];?>
</td>
		<td align="center"><?php echo $_smarty_tpl->tpl_vars['volist']->value['num'];?>
</td>
		<td align="center"><a href="listsp.php?action=edit&id=<?php echo $_smarty_tpl->tpl_vars['volist']->value['id'];?>
" class="icon-set">修改</a>&nbsp;&nbsp;<?php if ($_smarty_tpl->tpl_vars['uc_adminname']->value=='master'){?><a href="listsp.php?action=del&id[]=<?php echo $_smarty_tpl->tpl_vars['volist']->value['id'];?>
" class="icon-del">删除</a><?php }?></td>
	  </tr>
	  <?php }
if (!$_smarty_tpl->tpl_vars['volist']->_loop) {
?>
      <tr>
	    <td colspan="10" align="center">暂无碎片</td>
	  </tr>
	  <?php } ?>
	  <?php if ($_smarty_tpl->tpl_vars['total']->value>0){?>
	  <tr>
		<td align="center"><input name="chkAll" type="checkbox" id="chkAll" value="checkbox" /></td>
		<td class="hback" colspan="9"><input class="button" name="btn_del" type="button" value="删 除" onclick="{if(confirm('确定删除选定碎片吗!?')){$('#myform').submit();return true;}return false;}" class="button" />&nbsp;&nbsp;共[ <b><?php echo $_smarty_tpl->tpl_vars['total']->value;?>
</b> ]条记录</td>
	  </tr>
	  <?php }?>
	</table>
	</form>
  </div>
</div>
<?php }?>

<?php if ($_smarty_tpl->tpl_vars['action']->value=="add"){?>
<div class="main-wrap">
  <div class="path"><p>当前位置：内容中心<span>&gt;</span>添加碎片</p></div>
  <div class="main-cont">
	<h3 class="title"><a href="listsp.php" class="btn-general">返回碎片列表</a>添加碎片</h3>
    <form name="myform" id="myform" method="post" action="listsp.php">
    <input type="hidden" name="action" value="saveadd" />
	<table class='table_form'>
	  <tr>
		<th width="100">分类名称：<span class='f_red'>*</span></th>
		<td><input type="text" name="spname" id="spname" class="input-txt" /> <span class='f_red' id="dcatename"></span></td>
	  </tr>
	  <tr>
		<th>调用标签：<span class='f_red'>*</span></th>
		<td><input type="text" name="splabel" id="splabel" class="input-txt" /> <span class='f_red' id="dcatename"></span></td>
	  </tr>
	  <tr>
		<th>产品/新闻：<span class='f_red'></span></th>
		<td>
		  <input type="radio" name="np" value="1" checked="checked" class="np" />产品中心
		  <input type="radio" name="np" value="2" class="np" />新闻中心
		  <input type="radio" name="np" value="3" class="np" />案例中心
		</td>
	  </tr>
	  <tr>
		<th>产品或新闻分类：</th>
		<td><span id="np_cate"><?php echo $_smarty_tpl->tpl_vars['cate_select_p']->value;?>
</span></td>
	  </tr>
	  <tr>
	   <th>是否推荐：</th>
	   <td><input type='checkbox' id='recommend' name='recommend' value='1' />推荐</td>
	  </tr>
	  <tr class="disable">
	   <th>是否最新产品：</th>
	   <td><input type='checkbox' id='isnew' name='isnew' value='1' />新品</td>
	  </tr>
	  <tr>
	   <th>排序：</th>
	   <td>
	   	 <input type="radio" name="orders" value="0" checked="checked" />降序
	     <input type="radio" name="orders" value="1" />升序	    
	   </td>
	  </tr>
	  <tr>
	   <th>数目：</th>
	   <td><input type='text' id='num' name='num' /></td>
	  </tr>
	  <tr>
		<th>碎片说明： </th>
		<td><textarea name="intro" id="intro" style='width:60%;height:65px;overflow:auto;color:#444444;'></textarea></td>
	  </tr>
	  <tr>
		<th></th>
		<td><input type="submit" name="btn_save" class="button" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
  <div style="clear:both;"></div>
  <script type="text/javascript">
  $(".np").click(function()
  {
  	var val=$(this).val();
  	if(val==2 || val==3){
  		$(".disable").addClass("hide");
  	}else{
  		$(".disable").removeClass("hide");
  	}
  });
  </script>
</div>
<?php }?>

<?php if ($_smarty_tpl->tpl_vars['action']->value=="edit"){?>
<div class="main-wrap">
  <div class="path"><p>当前位置：内容中心<span>&gt;</span>编辑碎片</p></div>
  <div class="main-cont">
	<h3 class="title"><a href="listsp.php" class="btn-general">返回碎片列表</a>编辑碎片</h3>
    <form name="myform" id="myform" method="post" action="listsp.php">
    <input type="hidden" name="action" value="saveedit" />
	<input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
" />
	<table class='table_form'>
	  <tr>
		<th width="100">分类名称：<span class='f_red'>*</span></th>
		<td><input type="text" name="spname" id="spname" class="input-txt" value="<?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['spname'];?>
" /> <span class='f_red' id="dcatename"></span></td>
	  </tr>
	  <tr>
		<th>调用标签：<span class='f_red'>*</span></th>
		<td><input type="text" name="splabel" id="splabel" class="input-txt" <?php if ($_smarty_tpl->tpl_vars['uc_adminname']->value=='admin'){?>style="cursor:not-allowed;" readonly="readonly"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['splabel'];?>
" /> <span class='f_red' id="dcatename"></span></td>
	  </tr>
	  <tr>
		<th>产品/新闻：<span class='f_red'></span></th>
		<td>
		  <input type="radio" name="np" value="1" class="np" /> 产品中心
		  <input type="radio" name="np" value="2" class="np" /> 新闻中心
		  <input type="radio" name="np" value="3" class="np" /> 案例中心
		</td>
	  </tr>
	  <tr>
		<th>产品或新闻分类</th>
		<td><span id="np_cate"><?php echo $_smarty_tpl->tpl_vars['cate_select']->value;?>
</span></td>
	  </tr>
	  <tr>
	   <th>是否推荐：</th>
	   <td><input type='checkbox' id='recommend' name='recommend' value='1' /> 推荐</td>
	  </tr>
	  <tr class="disable">
	   <th>是否最新产品：</th>
	   <td><input type='checkbox' id='isnew' name='isnew' value='1' /> 新品</td>
	  </tr>
	  <tr>
	   <th>排序：</th>
	   <td>
	   	 <input type="radio" name="orders" value="0"<?php if ($_smarty_tpl->tpl_vars['sp_edit']->value['orders']==0){?>checked="checked"<?php }?> /> 降序
	     <input type="radio" name="orders" value="1"<?php if ($_smarty_tpl->tpl_vars['sp_edit']->value['orders']==1){?>checked="checked"<?php }?> /> 升序	    
	   </td>
	  </tr>
	  <tr>
	   <th>数目：</th>
	   <td><input type='text' id='num' name='num' value="<?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['num'];?>
" /></td>
	  </tr>
	  <tr>
		<th>碎片说明： </th>
		<td><textarea name="intro" id="intro" style='width:60%;height:65px;overflow:auto;color:#444444;'><?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['intro'];?>
</textarea></td>
	  </tr>
	  <tr>
		<th></th>
		<td><input type="submit" name="btn_save" class="button" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
  <div style="clear:both;"></div>
<script type="text/javascript">      
      //产品推荐和新闻的状态判断
	 var np = <?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['np'];?>
 - 1;
     $(".np").eq(np).attr("checked","checked");
     if(np == 2){
     	$(".disable").addClass("hide");
     }
     var recommend = <?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['recommend'];?>
;
     var isnew     = <?php echo $_smarty_tpl->tpl_vars['sp_edit']->value['isnew'];?>
;
     if(recommend){
    	 $("#recommend").attr("checked","checked");
     }
     if(isnew){
    	 $("#isnew").attr("checked","checked");
     }
     var npvalue=$(".np:checked").val();
     // alert(npvalue);
     if(npvalue==2) 
     {
        $(".disable").addClass("hide");
     }
	  $(".np").click(function()
	  {
	  	var val=$(this).val();
	  	if(val==2 || val==3){
	  		$(".disable").addClass("hide");
	  	}else{
	  		$(".disable").removeClass("hide");
	  	}
	  });
</script>  
</div>
<?php }?>
<script type="text/javascript">

//产品和新闻的Ajax切换      
$(".np").change(function(){
	  var np = $(this);
	  $.ajax({
		  type: "GET",
		  url: "listsp.php",
		  dataType: "html",
		  data: {"action":"add","np":np.val()},
		  success: function(data) { 
			  if(data){
				  $("#np_cate").html(data);
			  }else{
				  alert("选择类型失败！");
			  }
		  }
	  });	  
});
//推荐和新闻部可以同时选择
$("#recommend").click(function(){
	 if(this.checked){
		 $("#isnew").attr("checked",false);
	 }
});
$("#isnew").click(function(){
	 if(this.checked){
		 $("#recommend").attr("checked",false);
	 }
});  

</script>
</body>
</html>
<?php }} ?>